package jwlee.testrmi;

import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;

public class RmiHelloServer {

	public RmiHelloServer() {
	}

	public static void main(String[] args) {
		// 创建并安装安全管理器
		if (System.getSecurityManager() == null) {
			System.setSecurityManager(new RMISecurityManager());
		}

		try {
			// 创建远程对象
			RmiHelloRemoteObject ro = new RmiHelloRemoteObject();
			// 启动注册表
			LocateRegistry.createRegistry(7777);
			// 将名称绑定到对象
			Naming.rebind("rmi://10.13.0.24:7777/RmiHelloServer", ro);// 缺省端口号1099

			System.out.println("RMI Server is running...");
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}

	}
}